package ucm.controller;

import air_cp5620.util.ProcessPassword;
import java.security.NoSuchAlgorithmException;
import ucm.module.UC_LogM;


public class UC_LogC {
   private String name = null;
   private String password = null;
   private String roleid = null;

    public UC_LogC(String name, String password,String rolename) throws NoSuchAlgorithmException {
        this.name = name;
        this.password = ProcessPassword.encrypt(password);
        if (rolename.equals("Ordinary Account")) {
            this.roleid = "100001";
        }
        else if (rolename.equals("Account Manager")) {
            this.roleid = "100002";
        }
        else {
            this.roleid = "100003";
        }        
    }



    public boolean run()
    {
        UC_LogM uc_logm = new UC_LogM( name, password,roleid);
        return uc_logm.runLogin();
    }
}
